﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Netra
{
    abstract class Storage
    {
        private Dictionary<Merch,int> merchs;

        public int this[Merch towar]
        {
            get
            {
                if (!merchs.ContainsKey(towar))
                    merchs[towar] = 0;
                return merchs[towar];
            }
            set
            {
                merchs[towar] = value;
            }

        }

        public Storage()
        {
            merchs = new Dictionary<Merch, int>();
        }

        public abstract bool Load(Merch ware,int quantity);
        public abstract bool Take(Merch ware, int quantity);

        public override string ToString()
        {
            string s="";
            foreach(KeyValuePair<Merch,int> kvp in merchs)
            {
                s+=kvp.Key.ToString()+", ilość: "+kvp.Value.ToString()+"\n";
            }
            return s;
        }
    }
}
